package com.levenx.exception;

import com.levenx.constant.ResultStatus;
import com.levenx.validdate.ValidateCodeException;
import com.levenx.vo.Result;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@ControllerAdvice
public class SecurityExceptionResolver {

    @ExceptionHandler(ValidateCodeException.class)
    @ResponseBody
    public Result handleNullPointerException(ValidateCodeException ex) {
        return Result.newResult()
                .ofStatus(ResultStatus.SYSTEM_ERROR,ex.getMessage());
    }

}
